@echo off
setlocal enabledelayedexpansion
set TPC=C:\compilers\tp7\BIN\TPC.EXE
set BCPP=C:\compilers\BCC55\
set TASM2=TASM.EXE
set TLINK2=TLINK.EXE
if "%~x1" == ".pas" (
	if exist %~dps1%~ns1.exe (
		del %~dps1%~ns1.exe
	)
	cd %~dps1 
	@echo on
	%TPC% %~s1 -$L- -$D- 
	@echo off
	if "%2"=="-exec" (
		@echo on
		%~dps1%~ns1.exe
		@echo off
	)
)
if "%~x1" == ".asm" (
	if exist %~dps1%~ns1.exe (
		del %~dps1%~ns1.exe
	)
	if "%3"=="i32" (
		set TASM=TASM32.EXE
		set TLINK=iLINK32.EXE
	)
	cd %BCPP%Bin
	@echo on
	%TASM2% -I%~dps1 %~s1, %~dps1%~ns1.obj
	%TLINK2% %~dps1%~ns1.obj, %~dps1%~ns1.exe
	@echo off
	if "%2"=="-exec" (
		@echo on
		%~dps1%~ns1.exe
		@echo off
	)
)
if "%~x1" == ".cpp" (
	if exist %~dps1%~ns1.exe (
		del %~dps1%~ns1.exe
	)
	cd %BCPP%Bin
	@echo on
	bcc32.exe -I%~dps1 -n%~dps1 -v- %~s1
	@echo off
	if "%2"=="-exec" (
		@echo on
		%~dps1%~ns1.exe
		@echo off
	)
)
if "%~x1" == ".c" (
	if exist %~dps1%~ns1.exe (
		del %~dps1%~ns1.exe
	)
	cd %BCPP%Bin
	@echo on
	bcc32.exe -I%~dps1 -n%~dps1 -v- %~s1
	@echo off
	if "%2"=="-exec" (
		@echo on
		%~dps1%~ns1.exe
		@echo off
	)
)
echo.
pause